Closed
Conversation
- Add UserEntity with Clerk ID, rate limiting, and role management - Add CodeReviewEntity with encrypted code storage support - Add AgentFindingEntity with severity and quality metrics - Create enums: SeverityEnum, UserRole aligned with PostgreSQL ENUMs - Configure Alembic env.py for model discovery and autogenerate - Implement relationships with cascade delete for data integrity Related CGAI-15
- Create users table with Clerk ID, role, rate limiting fields - Create code_reviews table with encrypted code storage - Create agent_findings table with severity and metrics - Add PostgreSQL ENUMs: userrole, reviewstatus, severityenum - Add indexes for performance optimization - Configure cascade delete for data integrity Migration ID: ba48c1bb8e18 Related CGAI-15
feat(database): integrate Supabase PostgreSQL with SQLAlchemy models and Alembic migrations
- Add ClerkClient for JWT validation with HS256 algorithm - Add UserRepository for CRUD operations on users table - Add AuthService to orchestrate login and token validation - Add auth dependency (get_current_user, get_optional_user) - Add /api/v1/auth/login and /api/v1/auth/me endpoints - Sync users from Clerk to Supabase on login - Add email-validator dependency for pydantic EmailStr Closes CGAI-28
feat(auth): Clerk JWT authentication with Supabase user sync - Add ClerkClient for JWT validation with HS256 algorithm - Add UserRepository for CRUD operations on users table - Add AuthService to orchestrate login and token validation - Add auth dependency (get_current_user, get_optional_user) - Add /api/v1/auth/login and /api/v1/auth/me endpoints - Sync users from Clerk to Supabase on login - Add email-validator dependency for pydantic EmailStr Closes CGAI-28
- Add 12 tests for UserRepository (get_by_id, create, update, delete) - Add 10 tests for UserEntity (can_analyze, increment_analysis_count) - Add 9 integration tests for auth endpoints (/login, /me) - Coverage increased from 92% to 96%
- Add tests for CodeReviewEntity (__repr__, calculate_quality_score) - Add tests for AgentFindingEntity (penalty, to_dict, __repr__) - Add tests for get_db dependency (session lifecycle) - Fix auth router tests to accept 401/403 for missing token - Fix severity assertion to expect uppercase enum values Coverage improvements: - code_review.py: 89% -> 100% - finding.py: 88% -> 100% - get_db.py: 50% -> 100% Total: 175 tests, 97.46% coverage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 Descripción
Este PR aumenta la cobertura de tests del backend de 96.25% a 97.46% con 175 tests pasando.
🎯 Cambios Realizados
Nuevos Tests Agregados
tests/unit/models/test_code_review.pytests/unit/models/test_finding.pytests/unit/dependencies/test_get_db.pyTests Corregidos
test_auth_router.py: Corregidos tests de "missing token" para aceptar 401 o 403 (diferencia entre versiones de FastAPI/Starlette)test_finding.py: Corregido assertion de severity para esperar"HIGH"(mayúsculas) según el enum📊 Métricas de Cobertura
✅ Checklist
pytest tests/ --cov=src -v)🔗 Relacionado
feature/CGAI-increase-coverage📝 Notas
Los archivos con cobertura < 100% restantes son:
security_agent.py(92%) - Ramas de edge cases complejoscode_review_repository.py(89%) - Líneas 74-77 de manejo de erroressettings.py(95%) - Línea 57 de configuración condicionalobservers.py(83%) - Línea 22 de loggingschemas/analysis.py(99%) - Línea 80